home *** CD-ROM | disk | FTP | other *** search
- /*
- * #include <legal/bs.h>
- >
- > Copyright (c) 1989 Washington University in Saint Louis, Missouri and
- > Chris Myers. All rights reserved.
- >
- > Permission is hereby granted to copy, reproduce, redistribute or
- > otherwise use this software as long as: (1) there is no monetary
- > profit gained specifically from the use or reproduction of this
- > software, (2) it is not sold, rented, traded, or otherwise marketed,
- > (3) the above copyright notice and this paragraph is included
- > prominently in any copy made, and (4) that the name of the University
- > is not used to endorse or promote products derived from this software
- > without the specific prior written permission of the University.
- > THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- > IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- > WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- >
- * newsxd: a daemon for controlling the transmission of news
- *
- * Written by
- * Chris Myers Internet: chris@wugate.wustl.edu
- * Software Engineer UUCP: ...!uunet!wugate!chris
- * Office of the Network Coordinator BITNET: chris@wunet.bitnet
- * Washington University in Saint Louis
- *
- * HISTORY:
- * Version 0.1: first written in perl. A grand experiment that just didn't
- * work very reliably (no reflection on the quality of perl, it
- * just wasn't meant to do this kind of thing).
- *
- * Version 1.0: first C version
- *
- * 1.1: added per-host locking
- * 1.2: added maxload qualifier
- * 1.2.1: added time to live qualifier
- *
- * SOURCE CODE INADVERTANTLY DESTROYED (SIGH)
- * Oh well, it needed rewriting anyway. :-)
- *
- * Version 2.0: here we go again. No per-host locking right now :-(
- * Removed all static limits on the number of transmission
- * classes and hosts. Everything is now malloc'ed.
- * 2.0.1: added penalty time to time-to-live qualifier to allow other
- * hosts to get news transmitters started.
- * 2.1: Added the capability to specify a different transmission
- * program (and parameters) for each transmission class. This
- * was the motive for the name change from nntpxd to newsxd.
- * 2.1.1: fixed bug caused by defunct transmitters which finally
- * overran the ttl (did not do proper cleanup).
- * 2.1.2: added patches for Pyramid and BSD 4.3 support from Warren
- * Lavallee and Jim Lowe.
- * 2.1.3: fixed bugs in calculating the ttl penalty and start/stop
- * time ranges
- * 2.1.4: fixed bug in read_config where the loop went 1 past the end
- * of the options for a transmission class. This could cause
- * the last parameter on a longer preceeding class line to be
- * carried over to the subsequent classes.
- * 2.1.5: somehow the default value for nntplogs slipped away from the
- * code. Put it back in where it belongs.
- * 2.1.6: added inter-host startup interval for classes so that newsxd
- * doesn't start up too many daemons at once
- * 2.1.7: fix stupid bug created in earlier patch where I set argptr[x]
- * to NULL (what it was supposed to be) and then blithly reset it
- * to something else -- preventing EXECing the program specified
- * in an XMIT option. ARGH.
- * 2.1.8: ARGH! Left out the code to make sure a transmitter for each
- * host wasn't started up more often than <interval> seconds.
- * 2.2: Cut down on the size of the wishlist by adding a bunch of
- * features (and hopefully no more bugs):
- * - syslog logging
- * - lots of range/value checking on inputs
- * - sort host/class names when inserting into list
- * - move all configuration parameters into newsxd.h
- * - add more error messages
- * - document code even more
- * - allow reconfiguration without killing outstanding xmitters
- * - add a 'nobatchfile' switch
- * - allocation of alternate xmitter parameters is now dynamic
- * - Per-host delta-nice values for transmitters
- * - make code more readable
- * - write a manpage
- * 2.3: Add SIGUSR1, SIGUSR2 to {en,dis}able debugging while running
- * Shift the order of syslog initialization and switch to daemon
- * Fix a "go past end of the array sometimes" bug in getclass().
- * add "reason" to status display to show why xmitter not running
- * in xmit options, %f=flags,%w=workfile,%b=batchfile,%h=hostname
- * make transmission of news to hosts 'fair'
- * minimize a race in run_queue if SIGQUIT causes reconfiguration
- * change start/stop times to use UUCP-style permissible times
- * 2.3.1: fix bug in incr xmitsernum when only one service class in use
- * enable fair transmission code even if maxxmits > class members
- * change use of strpbrk to strchr and make strchr #define'd
- * 2.4: add per-host flags
- * added check for multiply-defined host/class in add{host,class}
- * zero classptr->members in addclass to allow reconfiguration
- * 2.4.1: classptr->members++ in addhost was in the wrong spot
- * buffer declaration for FAKESYSLOG had trailing ; should be ,
- * log a reinitialization message after getting SIGHUP
- * add -v switch to show version and logging
- * if debugging == ON in daemon mode, don't dump status to stderr
- * was closing pidfile with close() rather than fclose()
- * change comments in xmit_done() to show sig==0 is NOHANG
- * validtime() was mangling the valid times string
- * parsetime() sometimes said a good time was not valid
- * addhost() now resorts host list on reconfiguration
- * 2.4.2: modify xmit_done() to almost always use WNOHANG on wait calls
- * add_host() was improperly decrementing classptr->members
- * When debugging changes, log "On"/"Off" not the value (0/-1)
- * get rid of remaining code for obsolete "nntpxmit" keyword
- * finish updating comments, changing "nntpxmit" to "transmitter"
- * 2.5: sigsetmask(0) to allow SIGCHLD in xmit_done(); don't lose kids
- * modify "Why Not Running" messages slightly for readability
- * xmit_done() now loops to catch all completed transmitters
- * run_queue() now checks for MIA transmitters and cleans 'em up
- * if no classes defined, dump_config() now returns immediately
- * break the source apart into several files from one big'un
- * class options are default, w/host options overriding
- * [ttl, interval, nice, maxload]
- * run_queue() was setting whynotrunning wrong for active xmits
- * moved ttl penalty check into "host gave up chance" code to
- * prevent a penalized host from blocking others
- * added SIGIO to idle newsxd until SIGHUP is received
- * added class slots
- * added faster pid->host mapping data structure
- * added SIGTRAP to dump internal data structures for debugging
- * 2.5.1: apply "lint" fixes from Andrew Partan <asp@uunet.uu.net>
- * close and reopen logfiles on SIGHUP <asp@uunet.uu.net>
- * put Why Not reasons in static array, use everywhere
- * process.c: in fork()ed child, call _exit() not exit()
- * check for duplicate newsxd running
- * add support for per-class transmitter debugging flags
- * fix an open file leak in config.c:read_config()
- * add SIGIOT to kill all transmitters and idle newsxd
- * add setuid(geteuid()), setgid(getegid()) in main()
- * fix some potential null-ptr dereferencing problems in config.c
- * fix array-index overrun problem in config.c <asp@uunet.uu.net>
- * remove pidfile and statusfile on shutdown unless debug|DEBUG
- * flock() the work file before EXECing the transmitter
- * support CNEWS-style locking to prevent races on the work file
- * restore default signal action after fork() for transmitter
- *
- * SPECIAL THANKS TO:
- *
- * Alpha tester: John Coolidge <coolidge@brutus.cs.uiuc.edu>
- *
- * Beta testers: Warren Lavallee <warren@schizo.samsung.com>
- * Don Thomson <thomson@macc.wisc.edu>
- * Michael A. Cooper <mcooper@usc.edu>
- * Jim Lowe <james@csd4.csd.uwm.edu>
- * David C. Lawrence <tale@pawl.rpi.edu>
- * John Coolidge <coolidge@brutus.cs.uiuc.edu>
- * Lloyd W. Taylor <lloyd@aplcen.apl.jhu.edu>
- * Dave Alden <alden@shape.mps.ohio-state.edu>
- * Greg Hackney <root@texbell.sbc.com>
- * Rick Adams <rick@uunet.uu.net>
- * Andrew Partan <asp@uunet.uu.net>
- *
- * This software has been tested on the following systems:
- *
- * DECstation 3100, Ultrix 3.1
- * DEC VAX 8810, Ultrix 3.1
- * Sun 3/60, SunOS 4.0.1
- * Sun 3/180, SunOS 4.0.3
- * Pyramid DualPort OSx
- * DEC MicroVAX-II, BSD 4.3 UNIX
- * DEC MicroVAX-II, Mt Xinu MORE/BSD 4.3
- *
- * Wishlist:
- *
- * - add logging of transmitter resource usage
- * - Exponential backoff for failed transmission attempts
- * - Per-host locking, using shlock-style locks
- * - ability to specify min. # of articles queued before xmission starts
- * - add per-class workfile and batchfile definitions
- * - add per-host maximum delay between transmitter startups
- *
- */
-